﻿package com.njdj.gps.web.controller;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import com.njdj.gps.common.util.Utils;


public abstract class BaseController extends MultiActionController {

	protected final Log log = LogFactory.getLog(this.getClass());
	
	protected String getParameter(HttpServletRequest request,String param){
		String value = Utils.trim(request.getParameter(param));
		return value;
	}
	
	protected void setSessionObject(HttpServletRequest request,String key,Object obj){
		request.getSession().setAttribute(key, obj);
	}
	
	protected Object getSessionObject(HttpServletRequest request,String key){
		return request.getSession().getAttribute(key);
	}
	
	protected String getUserName(HttpServletRequest request){
		return (String) getSessionObject(request, "userName");
	}
	
	protected String getRole(HttpServletRequest request){
		return (String) getSessionObject(request, "role");
	}
	
	protected String getFullName(HttpServletRequest request){
		return (String) getSessionObject(request, "fullName");
	}

}
